/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.lucava.lib.client.view;

import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Panel;
import com.google.gwt.user.client.ui.Widget;
import java.util.HashMap;
import java.util.Map;

/**
 *
 * @author glenn
 */
public abstract class MvcLayout extends Composite {

    Map<String, Panel> viewHolder = new HashMap<String, Panel>();

    public void addToHolder(String key, Panel panel) {
        viewHolder.put(key, panel);
    }

    public void attachView(String key, Widget view) {

        if (viewHolder.containsKey(key)) {
            Panel panel = viewHolder.get(key);
            panel.clear();
            panel.add(view);
        }

    }
}
